package sample.test;

import static org.junit.Assert.assertEquals;

import org.databene.benerator.anno.Database;
import org.databene.benerator.anno.Source;
import org.databene.feed4junit.Feeder;
import org.junit.Test;
import org.junit.runner.RunWith;

import sample.code.UserAccess;

/*
 * Feed4JUnit - Get Data from Database, all test methods can use the database data
 */
@RunWith(Feeder.class)
@Database(
		id = "test", 
		url = "jdbc:mysql://localhost/test", 
		driver = "com.mysql.jdbc.Driver", 
		user = "root", 
		password = "123456")
public class F4JfromDB {

	@Test 
	@Source(id = "test", selector = "select * from TEST")
	public void testAccessCheck(String userName, String pw, String expected) {
		Boolean bSucess = UserAccess.accessCheck(userName.trim(), pw.trim());
		assertEquals(expected.trim(), bSucess.toString());

	}
}